package org.example.controller;

import com.sun.faces.action.RequestMapping;
import org.example.pojo.Student;
import org.example.util.SessionFactoryUtil;
import org.hibernate.Session;
import org.hibernate.query.Query;
import org.springframework.stereotype.Controller;

import javax.faces.bean.RequestScoped;
import java.util.List;

/**
 * @Author: HAPPY
 * @Project_name: hibernate
 * @Package_name: org.example.controller
 * @Date: 2021/9/26 21:25
 */
@Controller
public class StudentController {

   // @RequestMapping("/login")
    public String login(Integer id, String name){
        Session session = SessionFactoryUtil.getSessionFactory().openSession();
        Query query = session.createQuery("from org.example.pojo.Student.class");
        List<Student> list = query.list();
        return list.toString();
    }

}
